home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0036_Add a Bitmap to a Menu.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-11-22  |  971 b   |  36 lines

  1.  
  2. Maybe like this :
  3.  
  4. var
  5.    Bmp1 : TPicture;
  6.  
  7. ...
  8.  
  9. Bmp1 := TPicture.Create;
  10. Bmp1.LoadFromFile('c:\where\b1.BMP');
  11. SetMenuItemBitmaps(    MenuItemTest.Handle,
  12.             0,
  13.             MF_BYPOSITION,
  14.             Bmp1.Bitmap.Handle,
  15.             Bmp1.Bitmap.Handle);
  16. ...
  17.  
  18. Create a Picture.
  19. Load a .BMP from somewhere into the picture.
  20. Use the SetMenuItemBitmaps API call to connect the Picture to the Menu with
  21. these
  22. parameters :
  23. - MenuItemTest is the name given to the horizontal Menuitem
  24. - 0,1 ...   is the position of the item on which you want to place the
  25. bitmap. (start counting
  26. with 0)
  27. - The first of the two bitmap-handles is the one for the bitmap displayed
  28. for the unchecked
  29. menuitem.
  30. - The second is the one for the checked menuitem. These can be the same or not.
  31.  
  32. All this can by coded in the .Create of a form.
  33.  
  34. Result : It works, but only the right-top of the bitmap is displayed. Rest
  35. us to change the height and/or width of the menuitem according to the bitmap
  36.